<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title></title>
	<script src="../js/vue2.6.12.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<div id="app">
		<input type="text" name="" id="" v-model="inps" />
		<button type="button" @click="add()">添加</button>
		{{inps}}
		<div>
			<ul>
				<li v-for="(item,index) in todolists">{{item}} <button type="button" @click="del(index)">删除</button></li>
			</ul>
		</div>
	</div>
</body>
<script type="text/javascript">
	var vm=new Vue({
		el:'#app',
		data:{
			"inps":"",
			"todolists":[],
		},
		methods:{
			add(){
				// console.log(this.inps);
				this.todolists.push(this.inps);
			},
			del(index){
				this.todolists.splice(index,1);
			}
		}
	})
</script>
</html>